package com.rzico.scenic.controller;

import com.rzico.base.CommResult;
import com.rzico.scenic.entity.Area;
import com.rzico.scenic.service.AreaService;
import com.rzico.util.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 旅游景区分类控制层
 *
 * @author doucent xz
 * @version 1.0
 * @date 2020-12-30
 */
@Api(description = "旅游景区分类接口")
@RestController
@RequestMapping("/area")
public class AreaController {

    @Autowired
    AreaService areaService;

    @ApiOperation("景区分类查询")
    @GetMapping("/getArea/{parent}")
    public CommResult<Area> list(@PathVariable String parent) {
        Map<String, Object> params = new HashMap<String, Object>();
        if (StringUtils.isNotEmpty(parent)) {
            params.put("parent", parent);
        }
        List<Area> list = areaService.selectList(params);
        return CommResult.success(list);
    }
}
